<template>
	<view>

		<view v-if="payCostList.length > 0">

			<view class="item" v-for="(item, index) in payCostList" :key="index" @click="itemClick(item)">

				<view class="income_list">
					<image src="../../../static/mine/message/wz_icon.png" mode="scaleToFill"></image>

					<view class="income-item">
						<view class="income-title">
							<text class="income-title-name"  >汇聚</text>
							<text class="income-title-level">{{"￥"+filterNull(item.drawAmount)}}</text>
						</view>
						
						<view class="income-title">
							<text class="income-time" style="flex-grow: 1;">{{filterNull(item.createTime)}}</text>
							<text class="income-time" v-if="item.drawStatus == 0">提现成功</text>
							<text class="income-time" v-if="item.drawStatus == 1">提现失败</text>
							<text class="income-time" v-if="item.drawStatus == 2">提现中</text>
							
						</view>
					</view>
				</view>
			</view>
			<!-- <u-loadmore :status="loadingStatus" @loadmore="clickloadmore"></u-loadmore> -->
		</view>

		<no-data v-else></no-data>

	</view>
</template>

<script>
	import {
		withdrawalRecord,
		getWithDrawInfo
	} from '../../../common/api.js';

	export default {
		data() {
			return {
				distributorsId: '',
				isEnv: 0,
				pageNo: 1,
				loadingStatus: 'loading',
				payCostList: []
			}
		},

		onLoad() {
			this.getData()
		},

		methods: {

			getData() {
				getWithDrawInfo({
					memberNo : this.$store.state.user.userInfo.customerId,
					pageNo : this.pageNo,
					pageSize : 10
				}).then(res => {
					if (this.pageNo == 1) {
						this.payCostList = [];
						this.pageNo++;
						// uni.stopPullDownRefresh();

						this.loadingStatus = 'loadmore';
					} else {
						if (!uni.$u.test.isEmpty(res)) {
							this.pageNo++;

							this.loadingStatus = 'loadmore';
						} else {

							this.loadingStatus = 'nomore';
						}
					}

					if (!uni.$u.test.isEmpty(res)) {
						this.payCostList = this.payCostList.concat(res);
					}


				})
			},


			clickloadmore() {
				this.getData();
				this.showloading = true;
				this.loadingStatus = 'loading';
			},


		},
		onPullDownRefresh() {
			this.pageNo = 1;
			this.getData();
		},

		onReachBottom() {
			console.log('到底了');

			this.getData();
			this.showloading = true;
			this.loadingStatus = 'loading';
		}

	}
</script>

<style lang="scss" scoped>
	.income_list {
		@include flex;
		width: 100%;
		align-items: center;
		background-color: $white;

		image {
			width: 60upx;
			height: 60upx;
			// margin-left: 40upx;
		}

		.income-item {
			flex-grow: 1;
			margin: 40upx 40upx 20upx 0upx;
			@include flex(column);

			.income-title {
				@include flex;
				align-items: center;

				.income-title-name {
					font-size: 28upx;
					color: $black33;
					flex-grow: 1;
				}

				.income-title-level {
					font-size: 24upx;
					color: $black33;
					font-weight: bold;
				}

			}

			.income-time {
				font-size: 26upx;
				color: $graya7;
				margin-top: 10upx;
			}
		}

		.income-money {
			color: $green12;
			font-weight: bold;
			font-size: 28upx;
			margin-right: 40upx;
		}

	}
</style>
